package com.mashibing.singleton;

/**
 * 效率不高
 */
public class Mgro4 {
  public static Mgro4 INSTANCE;
  private Mgro4(){}
  public static synchronized Mgro4 getInstance(){
      if (INSTANCE==null){
          try{
              Thread.sleep(1);
          }catch (InterruptedException e){
              e.printStackTrace();
          }
          INSTANCE=new Mgro4();
      }
      return INSTANCE;
  }
    public void m(){
        System.out.println("m");
    }

    public static void main(String[] args) {
        for (int i=0;i<100;i++){
            new Thread(()->{
                System.out.println(Mgro4.getInstance().hashCode());
            }).start();
        }
    }
}
